package com.UI
{
	import com.*;
	import com.Engine.*;
	import com.Packet.*;
	
	import flash.display.*;
	import flash.events.*;
	import flash.external.*;
	import flash.filters.*;
	import flash.geom.*;
	import flash.system.*;
	import flash.text.*;
	import flash.ui.*;
	import flash.utils.*;
	
	import org.aswing.*;
	import org.aswing.border.*;
	import org.aswing.border.EmptyBorder;
	import org.aswing.colorchooser.*;
	import org.aswing.ext.*;
	import org.aswing.geom.*;
	public class ToolTipSkill extends JToolTip
	{
		protected var panelToolTipSkill:PanelToolTipSkill;
		public function ToolTipSkill()
		{
			this.setBackground(new ASColor(0,0));
			this.setForeground(new ASColor(0,0));
			this.setBackgroundDecorator(null);
			var layout0:EmptyLayout = new EmptyLayout();
			setLayout(layout0);
			
			panelToolTipSkill = new PanelToolTipSkill();
			panelToolTipSkill.setLocation(new IntPoint(0, 0));
			panelToolTipSkill.setSize(new IntDimension(200, 200));
			append(panelToolTipSkill);
			this.setClipMasked(false);
		}
		private var _item:Object;
		private var icon_id:int = 0;
		
		public function setItem(item:Object):void 
		{
			setTipText("");
			var width:int = 200;
			var height:int = 100;
			panelToolTipSkill.setItem(item);
			height = panelToolTipSkill.height;
			this.setPreferredWidth(200);
			setSize(new IntDimension(width, height));
			this.pack();
			this.paintImmediately();
			return;
		}
		public function clear():void
		{
			setBackgroundDecorator(null);
			//panelIcon.setBackgroundDecorator(null);
		}
	}
}

import com.*;
import com.Engine.*;
import com.Packet.*;
import com.UI.*;

import flash.display.*;
import flash.events.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;

import org.aswing.*;
import org.aswing.border.*;
import org.aswing.border.EmptyBorder;
import org.aswing.colorchooser.*;
import org.aswing.ext.*;
import org.aswing.geom.*;
/**
 * ToolTipItem
 */
class PanelToolTipSkill extends PanelToolTipItem{
	
	
	/**
	 * ToolTipItem Constructor
	 */
	public function PanelToolTipSkill(){
	}
	private var _item:Object;
	private var icon_id:int = 0;
	//private var filterArrayImage:Array = new Array(new GlowFilter(0xEA0000, 0.6, 34, 34, 2,1,true));
	override public function setItem(item:Object):void 
	{
		//setTipText("");
		textField.setHtmlText("");
		_item = null;
		//panelIcon.setBackgroundDecorator(null);
		if(item == null)
		{
			icon_id = 0;
			panelIcon.setBackgroundDecorator(null);
			return;
		}
		var objSkillCSV:Object = Client.getInstance().GetSkillCSV(item.csv_id);
		if(objSkillCSV == null)
		{
			icon_id = 0;
			panelIcon.setBackgroundDecorator(null);
			return;
		}
		if(icon_id != objSkillCSV.icon_id)
		{
			icon_id = objSkillCSV.icon_id;
			panelIcon.setBackgroundDecorator(new AssetBackground(Client.getSkillElement("img_skill_"+objSkillCSV.icon_id) as DisplayObject));
		}
		
		//panelIcon.setBackgroundDecorator(new AssetBackground(Client.getSkillElement("img_skill_"+objSkillCSV.icon_id) as DisplayObject));
		
		labelName.setText(objSkillCSV.name);
		
		var text:String = new String;
		//text += objItemCSV.name+"\n"
		if(objSkillCSV.description.length != 0)
			text += objSkillCSV.description +"\n";
		text += "\n"
		text += "种类:   "
		text += objSkillCSV.kind+"\n";
		//if(objSkillCSV.type == 0) text += "装备\n";//装备
		//if(objSkillCSV.type == 1) text += "药品\n";//装备
		//if(objSkillCSV.type == 2) text += "宝石\n";//装备
		//if(objSkillCSV.type == 3) text += "符咒\n";//装备
		
		
		if(objSkillCSV.require_level > 0)
			text += "等级要求:   "+'<font color="#FFFF00">'+objSkillCSV.require_level +"</font>\n"
		
		if(objSkillCSV.require_gender == 0 || objSkillCSV.require_gender == 1)
			text += "性别要求:   "+'<font color="#FFFF00">'+(objSkillCSV.require_gender == 0?"男":"女") +"</font>\n";
		
		text += "技能等级:   "+ '<font color="#FFFF00">'+item.m_nLevel +"</font>\n";
		if(item.m_nTargetCount > 0)
			text += "目标数:   "+ '<font color="#FFFF00">'+item.m_nTargetCount +"</font>\n";
		if(item.m_nRoundCount > 0)
			text += "回合数:   "+ '<font color="#FFFF00">'+item.m_nRoundCount +"</font>\n";
		if(item.m_nSuccessRate > 0)
			text += "成功率:   "+ '<font color="#FFFF00">'+item.m_nSuccessRate +"%</font>\n";
		if(item.m_nConsumeHPRate > 0)
			text += "消耗生命百分比:   "+ '<font color="#FF0000">'+item.m_nConsumeHPRate +"%</font>\n";
		
		_item = item;

		textField.setHtmlText(text);
		textField.pack();
		textField.paintImmediately();
		panelBottom.pack();
		panelBottom.paintImmediately();
		var square:Sprite = new Sprite();
		
		square.graphics.beginFill(0x033332, 0.9);
		square.graphics.drawRoundRectComplex(0,0,width,height,5,5,5,5);
		square.graphics.endFill();
		setBackgroundDecorator(new AssetBackground(square as DisplayObject));
		
		//panelIcon.filters = enableUse ? null :filterArrayImage;
		panelIcon.pack();
		panelIcon.paintImmediately();
		this.pack();
		this.paintImmediately();
		
	}	
}